
const publick = {
    //饼状图的线性渐变
    request:1,
    linearColor(starColor,endCorlor) {
        if(!starColor || !endCorlor) {
             console.log('参数不能为空')
             return 
        }
        let color = {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [ 
                {
                    offset: 0, color: starColor        // 0% 处的颜色
                },
                {
                    offset: 1, color: endCorlor        // 100% 处的颜色
                }
            ],
            global: false // 缺省为 false
        };
        return color
    },
    //bar 的渐变色彩
    barColor(starColor,endCorlor) {
      return  new echarts.graphic.LinearGradient( 
            0, 0, 1, 0,
            [
                {offset: 0, color: starColor},
                {offset: 1, color: endCorlor},

            ]
        )
    
    },
        //初始化dom，以及传递参数，绘制图表
    piceChart(elementId,option,subject = null) {
        var store = echarts.init(document.getElementById(elementId),subject)
        var option = option
        store.setOption(option)
     }
}

export default publick